import orm
def login():
    name=input('请输入用户名:')
    pwd=input('请输入密码:')
    tag=0
    path=r"username.json"
    data=orm.read_data(path)
    for user in data:
        if user['username']==name and user['password']==pwd:
            tag=1
            break
    return  tag
def register():
    path = r'username.json'
    name = input('请输入注册的用户名：')
    pwd = input('请输入注册的密码：')
    new_user = {"username":name,'password':pwd}
    user_list=orm.read_data(path)
    user_list.append(new_user)
    orm.write_data(user_list,path)
if __name__ == '__main__':
    # print(assert())
    register()